package test.session;

import java.io.IOException;
import java.io.OutputStream;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import test.image.VerifyImage;

public class VerifyImageServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        VerifyImage image = new VerifyImage();
        OutputStream out = resp.getOutputStream();
        VerifyImage.output(image.getVerifyImage(), out);
        req.getSession().setAttribute("verify_code", image.getText());
    }
}
